//
//  PayLatestMoneyTableViewCell.m
//  PropertyManager
//
//  Created by TNG on 2018/8/28.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "PayLatestMoneyTableViewCell.h"

@implementation PayLatestMoneyTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self creatUI];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = SFM242;
    }
    return self;
}

-(void)creatUI{
    [self.contentView addSubview:self.bgView];
    [self.bgView addSubview:self.titleLabel];
    [self.bgView addSubview:self.moneyLavel];
    [self.bgView addSubview:self.rentLabel];
//    [self.bgView addSubview:self.lineView];
//    [self.bgView addSubview:self.managerLabel];
    [self.contentView addSubview:self.leftView];
    [self.contentView addSubview:self.rightView];
}

-(UIView *)bgView
{
    if (_bgView == nil) {
        _bgView = [[UIView alloc] initWithFrame:CGRectMake(25, 20, WIDTH - 50, 197)];
        _bgView.backgroundColor = SFMWhiteColor;
    }
    return _bgView;
}

-(UILabel *)titleLabel
{
    if (_titleLabel == nil) {
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 32, WIDTH - 50, 21)];
        _titleLabel.font = font(16);
        _titleLabel.textColor = SFM51;
        _titleLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _titleLabel;
}

-(UILabel *)moneyLavel
{
    if (_moneyLavel == nil) {
        _moneyLavel = [[UILabel alloc] initWithFrame:CGRectMake(0, 68, WIDTH - 50, 30)];
        _moneyLavel.font = font(36);
        _moneyLavel.textColor = SFM51;
        _moneyLavel.textAlignment = NSTextAlignmentCenter;
    }
    return _moneyLavel;
}

-(UILabel *)rentLabel
{
    if (_rentLabel == nil) {
        _rentLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 128, WIDTH - 50, 21)];
        _rentLabel.font = font(16);
        _rentLabel.textColor = SFMColor(111, 122, 141);
        _rentLabel.textAlignment = NSTextAlignmentCenter;
    }
    return _rentLabel;
}

-(UIView *)lineView
{
    if (_lineView == nil) {
        _lineView = [[UIView alloc] initWithFrame:CGRectMake(WIDTH/2 - 25.5, 131, 1, 15)];
        _lineView.backgroundColor = SFMColor(111, 122, 141);
    }
    return _lineView;
}

-(UILabel *)managerLabel
{
    if (_managerLabel == nil) {
        _managerLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH/2 - 5, 128, WIDTH/2 - 35, 21)];
        _managerLabel.font = font(16);
        _managerLabel.textColor = SFMColor(111, 122, 141);;
        _managerLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _managerLabel;
}

-(UIView *)leftView
{
    if (_leftView == nil) {
        _leftView = [[UIView alloc] initWithFrame:CGRectMake(15, 50, 20, 20)];
        _leftView.backgroundColor = SFM242;
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_leftView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(10, 10)];
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
        maskLayer.frame = _leftView.bounds;
        maskLayer.path = maskPath.CGPath;
        _leftView.layer.mask = maskLayer;
    }
    return _leftView;
}

-(UIView *)rightView
{
    if (_rightView == nil) {
        _rightView = [[UIView alloc] initWithFrame:CGRectMake(WIDTH - 35, 50, 20, 20)];
        _rightView.backgroundColor = SFM242;
        UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:_rightView.bounds byRoundingCorners:UIRectCornerAllCorners cornerRadii:CGSizeMake(10, 10)];
        CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
        maskLayer.frame = _rightView.bounds;
        maskLayer.path = maskPath.CGPath;
        _rightView.layer.mask = maskLayer;
    }
    return _rightView;
}

-(void)send
{
    self.titleLabel.text = @"账单金额";
    self.moneyLavel.text = @"￥2000";
    self.rentLabel.attributedText = [NSMutableAttributedString headStr:@"租金" AndMiddleStr:@"￥1000" AndFootStr:@"" AndFont:font(16) AndTextColor:SFMColor(254, 101, 54)];
    self.managerLabel.attributedText = [NSMutableAttributedString headStr:@"管理费" AndMiddleStr:@"￥450" AndFootStr:@"" AndFont:font(16) AndTextColor:SFMColor(254, 101, 54)];
}

-(void)sendPayMoneyModel:(PayMoneyModel *)model
{
    self.titleLabel.text = @"账单金额";
    self.moneyLavel.text = [NSString stringWithFormat:@"￥%@",model.nyreceivable];
    self.rentLabel.attributedText = [NSMutableAttributedString headStr:model.faretype AndMiddleStr:[NSString stringWithFormat:@"￥%@",model.nyreceivable] AndFootStr:@"" AndFont:font(16) AndTextColor:SFMColor(254, 101, 54)];
}

-(void)sendHistoryPayModel:(HistoryPayModel *)model
{
    self.titleLabel.text = @"账单金额";
    self.moneyLavel.text = [NSString stringWithFormat:@"￥%@",model.nyreceivable];
    self.rentLabel.attributedText = [NSMutableAttributedString headStr:model.faretype AndMiddleStr:[NSString stringWithFormat:@"￥%@",model.nyreceivable] AndFootStr:@"" AndFont:font(16) AndTextColor:SFMColor(254, 101, 54)];
}

-(void)sendoverDueNoPayModel:(overDueNoPayModel *)model
{
    self.titleLabel.text = @"账单金额";
    self.moneyLavel.text = [NSString stringWithFormat:@"￥%@",model.nyreceivable];
    self.rentLabel.attributedText = [NSMutableAttributedString headStr:model.faretype AndMiddleStr:[NSString stringWithFormat:@"￥%@",model.nyreceivable] AndFootStr:@"" AndFont:font(16) AndTextColor:SFMColor(254, 101, 54)];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
